package day06;

import java.util.Arrays;

public class MethodDemo {
    public static void main(String[] args) {
        //say();
        sayHi("zyd");
        sayHello("zhangsan",35);
        sayHello("lisi",20);
        System.out.println(getNum());
        int a =plus(1,2);
        System.out.println(a);
        System.out.println(plus(5,6));
        int a1=4,a2=3;
        int a3=plus(a1,a2);
        System.out.println(a3);
        System.out.println("-----数组--");
        int[] arr=testArray(5,100);
        System.out.println("第一个元素是"+arr[0]);
        System.out.println("数组长度为"+arr.length);
        System.out.println("---遍历数组---");
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("--排序--");
        Arrays.sort(arr);
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("排序后第一个数组是"+arr[0]);
        aMethod();
        System.out.println(444);
    }

    public static void aMethod(){
        System.out.println(111);
        bMethod();
        System.out.println(222);
    }

    public static void bMethod(){
        System.out.println(333);
    }

    public static int[] testArray(int len,int max){
        int []arr=new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int) (Math.random()*(max+1 ));
        }
        return arr;
    }

    public static int plus(int num1,int num2){
        int num=num1+num2;
        return num;
    }

    public static double getNum(){
        return 2.1;
    }

    public static void sayHello(String name,int age){
        System.out.println("你好，我叫"+name+",今年"+age);
    }

    public static void sayHi(String name){
        System.out.println("你好，我叫"+name+",今年18");
    }



    public static void say(){
        System.out.println("你好，你不好，你可能很好");
    }
}
